﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Graphics;

namespace ContentPipelineExtension
{
    [ContentSerializerRuntimeType("JustinsGame.Engine.Tile, JustinsGame")]
    public class TempTileContent
    {
        public ExternalReference<Texture2DContent> Texture;
        public Rectangle SourceRectangle;
        public SpriteEffects SpriteEffects;
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.Layer, JustinsGame")]
    public class TempLayerContent
    {
        public int Width;
        public int Height;
        public List<TempTileContent> Tiles = new List<TempTileContent>();
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.Map, JustinsGame")]
    public class TempMapContent
    {
        public int TileWidth;
        public int TileHeight;
        public Vector2 GridPosition;
        public String BulletSpawner;
        public List<TempLayerContent> Layers = new List<TempLayerContent>();
        public List<TempMapObjectLayerContent> MapObjectLayers = new List<TempMapObjectLayerContent>();
        public List<TempMapEventContent> Events = new List<TempMapEventContent>();
        public List<PathContent> Paths = new List<PathContent>();
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.MapObjectLayer, JustinsGame")]
    public class TempMapObjectLayerContent
    {
        public String Name;
        public List<TempMapObjectContent> MapObjects = new List<TempMapObjectContent>();
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.MapObject, JustinsGame")]
    public class TempMapObjectContent
    {
        public int Id;
        public Rectangle Bounds;
        public String Name;
        public String Type;
        public bool IsCollidable;
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.MapEvent, JustinsGame")]
    public class TempMapEventContent
    {
        public int SecondsBetweenWaves;
        public List<TempMapEventWaveContent> Waves = new List<TempMapEventWaveContent>();
        public List<TriggerContent> Triggers = new List<TriggerContent>();
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.MapEventWave, JustinsGame")]
    public class TempMapEventWaveContent
    {
        public int MillisecondsBetweenEnemies;
        public List<TempMapEventWaveEnemyContent> Enemies = new List<TempMapEventWaveEnemyContent>();
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.MapEventWaveEnemy, JustinsGame")]
    public class TempMapEventWaveEnemyContent
    {
        public int Type;
        public int Count;
        public bool HasWeapon;
        public List<Vector2> Path = new List<Vector2>();
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.Trigger, JustinsGame")]
    public class TriggerContent
    {
        public string Type;
        public List<TriggerActionContent> Actions = new List<TriggerActionContent>();
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.TriggerAction, JustinsGame")]
    public class TriggerActionContent
    {
        public string Type;
        public int EntityId;
        public List<Vector2> Path = new List<Vector2>();
        public List<int> SubscriberIds = new List<int>();
    }

    [ContentSerializerRuntimeType("JustinsGame.Engine.Path, JustinsGame")]
    public class PathContent
    {
        public int Id;
        public List<Vector2> Destinations = new List<Vector2>();
    }
}
